import request from '@/utils/request'
//import gconfig from '@/config/global_config'

function getAllBooks(pagination) {
    var condition = "?name=" + pagination.name + "&type=" + pagination.type + "&description=" + pagination.description;
    var reqUrl =  "/books" + "/" + pagination.currentPage + "/" + pagination.pageSize + condition
    return request({
        url: reqUrl,
        method: "get",
        data: {},
        needAuthentication: true
    });
}


function getBookById(book_id) {
    return request({
        url: "/books/" + book_id,
        method: "get",
        data: {},
        needAuthentication: true
    });
}

// function getUserInfo() {
//     return request.get("/user/userInfo")
// }

// /**
//  * 更新用户信息
//  * @param {object} userInfo 用户信息
//  * @returns promise
//  */
// function updateUserInfo(userInfo) {
//     return request({
//         url: "/user/userInfo",
//         method: "put",
//         data: userInfo,
//         needAuthentication: true
//     })
// }

export {
    getAllBooks,
    getBookById
}